//
//  ViewController.swift
//  CTCollectionViewDemo
//
//  Created by GodCoder on 2019/8/6.
//  Copyright © 2019 CTCollectionView. All rights reserved.
//

import UIKit

class ViewController: UIViewController {

    let titles: [String] = ["头部拉伸", "item移动", "滚动、缩放", "items叠加和拖拽", "多选", "添加和删除"]
    
    @IBOutlet weak var tableView: UITableView!
    override func viewDidLoad() {
        super.viewDidLoad()
        self.title = "DemoList"
        tableView.register(UITableViewCell.self, forCellReuseIdentifier: "UITableViewCellID")
    }
}

extension ViewController: UITableViewDataSource {
    func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
        return titles.count
    }
    
    func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
        let cell = tableView.dequeueReusableCell(withIdentifier: "UITableViewCellID")
        cell?.selectionStyle = .none
        cell?.textLabel?.textColor = UIColor.white
        cell?.backgroundColor = UIColor.clear

       cell?.textLabel?.text = titles[indexPath.row]

        return cell!
    }
}

extension ViewController: UITableViewDelegate {
    func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
        switch indexPath.row {
        case 0:
            self.navigationController?.pushViewController(HeaderDragController(), animated: true)
        case 1:
            self.navigationController?.pushViewController(LevelViewController(), animated: true)
        case 2:
            self.navigationController?.pushViewController(ScrollViewController(), animated: true)
        case 3:
            self.navigationController?.pushViewController(PileUpViewController(), animated: true)
        case 4:
            self.navigationController?.pushViewController(SelectViewController(), animated: true)
        case 5:
            self.navigationController?.pushViewController(AddAndDelViewController(), animated: true)
        default:
            return
        }
    }
}
